<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
        <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>	
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Item 게시글 작성</title>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.0.js"></script>
<script type="text/javascript">
 $(document).ready(function(){
	$("#item_registerForm").submit(function(){			
		if($(":input[name=itemTitle]").val()==""){
			alert("상품명을 입력하세요");				
			return false;
		}
		if($(":input[name=itemPrice]").val()==""){
			alert("가격을 입력하세요");				
			return false;
		}
		if($(":input[name=itemInfo]").val()==""){
			alert("상품의 상세정보를 입력하세요");				
			return false;
		}	
	});
});
</script>
</head>
<body>
<div id="mainCss" align="center">
<form id="item_registerForm" action="${initParam.root}item/update.moja" method="post">
<table border="1">
<tr>
<td colspan="2">
<div align="center">
<h3>Item 게시글 작성</h3>
</div>
</td>
</tr>
<tr>
<td>작성자 : </td>
<td><input type="text" readonly="readonly" name="memberId" value="${requestScope.ivo.memberId }"></td>
</tr>
<tr>
	<td>상품번호 : </td> <td><input type="text" readonly="readonly" name="itemNo" value="${requestScope.ivo.itemNo}">
	</td>
</tr>
<tr>
<td>상품명 : </td>
<td><input type="text" name="itemName" value="${requestScope.ivo.itemName}"></td>
</tr>
<tr><td>상품가격 : </td><td><input type="text" name="itemPrice" value="${requestScope.ivo.itemPrice}">원</td></tr>
<%--  <tr>
<td>파일 : </td><td><input type="file" name="fileDir"><br>
<input type="submit" value="파일업로드"></td>
</tr> --%>
 <tr>
<td>파일 : </td><td><input type="file" name="fileDir" value="${requestScope.ivo.fileDir}"><br>
</td>
</tr>
<tr>
<td colspan="2">상세설명</td>
</tr>
<tr><td colspan="2">
<textarea cols="32" rows="10" name="itemInfo" id="itemInfo">${requestScope.ivo.itemInfo }</textarea>
</td></tr>
<tr>
<td colspan="2">카테고리(여러개 선택가능)</td>
</tr>
<tr>
<td colspan="2">
<c:forEach items="${requestScope.map }" var="map">
	${map.key } : <br>
	<c:forEach items="${map.value }" var="list">
		<input type="checkbox" name="${map.key }" value="${list }">${list }
	</c:forEach>
	<br>
</c:forEach>

</td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<input type="submit" value="작성완료">
<input type="submit" value="작성취소">
</div>
</td>
</tr>
</table>
</form>
</div>
</body>
</html>